package com.jixiang.order.controller;

import com.jixiang.model.order.dtos.OrderDtos;
import com.jixiang.order.service.OrderCreateService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import static com.jixiang.common.constants.CodeMqConstants.*;

@Controller
public class OrderCreateController {

    @Autowired
    OrderCreateService orderCreateService;

    @RabbitListener(queues = MQ_QUEUE_ORDER)
    public void listenCode(OrderDtos orderDtos){
        orderCreateService.createOrder(orderDtos);
    }


    @RabbitListener(queues = MQ_QUEUE_UPDATEORDER)
    public void listenUpdateOrder(OrderDtos orderDtos){
        orderCreateService.UpDateOrder(orderDtos);
    }
}
